﻿<ctrls:Exercicio x:Class="Visualizacao3D.Exercicio10.Exercicio10"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:p3d="http://www.codeplex.com/perspective"
                 xmlns:tools="clr-namespace:_3DTools;assembly=3DTools"
                 xmlns:ctrls="clr-namespace:Visualizacao3D.Controls">

    <ctrls:Exercicio.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Exercicio10_MaterialResources.xaml" />
                <ResourceDictionary Source="Exercicio10_TransformResources.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </ctrls:Exercicio.Resources>

    <!--
    EXERCÍCIO 10
    ============
    Definições:
    1 u = 1 m
    1 u = 5 kN
    Diagramas:
    1 u = 10 kN
    -->

    <tools:TrackballDecorator x:Name="MainTrackballDecorator">
        <Viewport3D x:Name="MainViewport">
            <Viewport3D.Camera>
                <PerspectiveCamera Position="6,2,9"
                                   LookDirection="-6, -2, -9" />
            </Viewport3D.Camera>
            <ModelVisual3D>
                <ModelVisual3D.Content>
                    <Model3DGroup>
                        <DirectionalLight Color="#FFFFFFFF"
                                          Direction="-10, 0, -15" />
                        <DirectionalLight Color="#FFFFFFFF"
                                          Direction="10, 0, 15" />
                        <DirectionalLight Color="#FFFFFFFF"
                                          Direction="0, -10, 0" />
                    </Model3DGroup>
                </ModelVisual3D.Content>
            </ModelVisual3D>

            <tools:ScreenSpaceLines3D Transform="{StaticResource Transform_Geral}"
                                      Thickness="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarBoundingBox, Converter={StaticResource BooleanToBoundingBoxThicknessConverter}}"
                                      Points="0,0,0 4,0,0 
                                                  0,4,0 4,4,0 
                                                  0,0,4 4,0,4
                                                  0,4,4 4,4,4
                                                  0,0,0 0,4,0
                                                  4,0,0 4,4,0
                                                  0,0,4 0,4,4
                                                  4,0,4 4,4,4
                                                  0,0,0 0,0,4
                                                  4,0,0 4,0,4
                                                  0,4,0 0,4,4
                                                  4,4,0 4,4,4"
                                      Color="Gray" />

            <ContainerUIElement3D x:Name="MainContainer"
                                  Transform="{StaticResource Transform_Geral}">
                <ContainerUIElement3D.Children>

                    <!-- TODO: tirar-->
                    <p3d:XyzAxis3D Color="Red"
                                   Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarEixos, Converter={StaticResource BooleanToVisibilityConverter}}" />

                    <!-- Engastamento -->
                    <ContainerUIElement3D x:Name="Apoios"
                                          Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarApoios, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <ContainerUIElement3D.Children>
                            <p3d:Box3D x:Name="Engastamento"
                                       ToolTipService.ToolTip="Nó A (Engastamento)"
                                       Material="{StaticResource Material_Barra}"
                                       BackMaterial="{x:Null}"
                                       Transform="{StaticResource Transform_Engastamento}" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>

                    <!-- Barras - Definição: O ponto A é o engastamento -->

                    <ContainerUIElement3D Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarBarras, Converter={StaticResource BooleanToVisibilityConverter}}"
                                          x:Name="Barras">
                        <ContainerUIElement3D.Children>
                            <p3d:Bar3D x:Name="BarraAB"
                                       ToolTipService.ToolTip="4 m"
                                       SideCount="50"
                                       RoundingRate="0.15"
                                       Material="{StaticResource Material_Barra}"
                                       BackMaterial="{x:Null}"
                                       Transform="{StaticResource Transform_BarraAB}" />
                            <p3d:Bar3D x:Name="BarraBC"
                                       ToolTipService.ToolTip="1 m"
                                       SideCount="50"
                                       RoundingRate="0.15"
                                       Material="{StaticResource Material_Barra}"
                                       BackMaterial="{x:Null}"
                                       Transform="{StaticResource Transform_BarraBC}" />
                            <p3d:Bar3D x:Name="BarraCD"
                                       ToolTipService.ToolTip="4 m"
                                       SideCount="50"
                                       RoundingRate="0.15"
                                       Material="{StaticResource Material_Barra}"
                                       BackMaterial="{x:Null}"
                                       Transform="{StaticResource Transform_BarraCD}" />
                            <p3d:Bar3D x:Name="BarraBE"
                                       ToolTipService.ToolTip="3 m"
                                       SideCount="50"
                                       RoundingRate="0.15"
                                       Material="{StaticResource Material_Barra}"
                                       BackMaterial="{x:Null}"
                                       Transform="{StaticResource Transform_BarraBE}" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>

                    <!-- Nós -->
                    <ContainerUIElement3D Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarBarras, Converter={StaticResource BooleanToVisibilityConverter}}"
                                          x:Name="Nos">
                        <ContainerUIElement3D.Children>
                            <p3d:Spherical3D x:Name="NoB"
                                             ToolTipService.ToolTip="Nó B"
                                             Material="{StaticResource Material_Barra}"
                                             BackMaterial="{x:Null}"
                                             Transform="{StaticResource Transform_NoB}" />
                            <p3d:Spherical3D x:Name="NoC"
                                             ToolTipService.ToolTip="Nó C"
                                             Material="{StaticResource Material_Barra}"
                                             BackMaterial="{x:Null}"
                                             Transform="{StaticResource Transform_NoC}" />
                            <p3d:Spherical3D x:Name="NoD"
                                             ToolTipService.ToolTip="Nó D"
                                             Material="{StaticResource Material_Barra}"
                                             BackMaterial="{x:Null}"
                                             Transform="{StaticResource Transform_NoD}" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>

                    <!-- Forças -->
                    <ContainerUIElement3D Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarVetores, Converter={StaticResource BooleanToVisibilityConverter}}"
                                          x:Name="Forcas">
                        <ContainerUIElement3D.Children>
                            <p3d:Arrow3D x:Name="ForcaD"
                                         ToolTipService.ToolTip="5 kN"
                                         Length="1"
                                         Material="{StaticResource Material_VetorForca}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_ForcaD}" />
                            <p3d:Arrow3D x:Name="ForcaE"
                                         ToolTipService.ToolTip="5 kN"
                                         Length="1"
                                         Material="{StaticResource Material_VetorForca}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_ForcaE}" />

                            <p3d:Arrow3D x:Name="CargaCD01"
                                         ToolTipService.ToolTip="3 kN/m"
                                         Length="0.6"
                                         Material="{StaticResource Material_VetorCarga}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_CargaCD01}" />
                            <p3d:Arrow3D x:Name="CargaCD02"
                                         ToolTipService.ToolTip="3 kN/m"
                                         Length="0.6"
                                         Material="{StaticResource Material_VetorCarga}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_CargaCD02}" />
                            <p3d:Arrow3D x:Name="CargaCD03"
                                         ToolTipService.ToolTip="3 kN/m"
                                         Length="0.6"
                                         Material="{StaticResource Material_VetorCarga}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_CargaCD03}" />
                            <p3d:Arrow3D x:Name="CargaCD04"
                                         ToolTipService.ToolTip="3 kN/m"
                                         Length="0.6"
                                         Material="{StaticResource Material_VetorCarga}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_CargaCD04}" />
                            <p3d:Arrow3D x:Name="CargaCD05"
                                         ToolTipService.ToolTip="3 kN/m"
                                         Length="0.6"
                                         Material="{StaticResource Material_VetorCarga}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_CargaCD05}" />
                            <p3d:Arrow3D x:Name="CargaCD06"
                                         ToolTipService.ToolTip="3 kN/m"
                                         Length="0.6"
                                         Material="{StaticResource Material_VetorCarga}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_CargaCD06}" />

                            <p3d:Arrow3D x:Name="CargaCD07"
                                         ToolTipService.ToolTip="3 kN/m"
                                         Length="0.6"
                                         Material="{StaticResource Material_VetorCarga}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_CargaCD07}" />

                            <p3d:Arrow3D x:Name="CargaCD08"
                                         ToolTipService.ToolTip="3 kN/m"
                                         Length="0.6"
                                         Material="{StaticResource Material_VetorCarga}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_CargaCD08}" />

                            <p3d:Arrow3D x:Name="CargaCD09"
                                         ToolTipService.ToolTip="3 kN/m"
                                         Length="0.6"
                                         Material="{StaticResource Material_VetorCarga}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_CargaCD09}" />

                            <p3d:Arrow3D x:Name="CargaCD10"
                                         ToolTipService.ToolTip="3 kN/m"
                                         Length="0.6"
                                         Material="{StaticResource Material_VetorCarga}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_CargaCD10}" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>

                    <!-- Graficos -->

                    <!-- Cortantes -->
                    <ContainerUIElement3D x:Name="Graficos_Cortantes"
                                          Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarGraficosCortantes, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <ContainerUIElement3D.Children>
                            <p3d:Square3D x:Name="Grafico_CortanteAB_XY"
                                          Material="{StaticResource Material_Grafico_CortanteAB_XY}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_CortanteAB_XY}"
                                          ToolTipService.ToolTip="Cortante - AB (plano XY) : +12 kN" />

                            <p3d:Square3D x:Name="Grafico_CortanteBC"
                                          Material="{StaticResource Material_Grafico_CortanteBC}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_CortanteBC}"
                                          ToolTipService.ToolTip="Cortante - BC : +5 kN" />

                            <p3d:Square3D x:Name="Grafico_CortanteAB_XZ"
                                          Material="{StaticResource Material_Grafico_CortanteAB_XZ}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_CortanteAB_XZ}"
                                          ToolTipService.ToolTip="Cortante - AB (plano XZ) : -5 kN" />

                            <p3d:Square3D x:Name="Grafico_CortanteBE"
                                          Material="{StaticResource Material_Grafico_CortanteBE}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_CortanteBE}"
                                          ToolTipService.ToolTip="Cortante - BE : +5 kN" />

                            <p3d:Square3D x:Name="Grafico_CortanteCD_YZ"
                                          Material="{StaticResource Material_Grafico_CortanteCD_YZ}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_CortanteCD_YZ}"
                                          ToolTipService.ToolTip="Cortante - CD (plano YZ) : +12 kN -> 0" />

                            <p3d:Square3D x:Name="Grafico_CortanteCD_XZ"
                                          Material="{StaticResource Material_Grafico_CortanteCD_XZ}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_CortanteCD_XZ}"
                                          ToolTipService.ToolTip="Cortante - CD (plano XZ) : -5 kN" />

                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>
                    <!-- Fletores -->
                    <ContainerUIElement3D x:Name="Graficos_Fletores"
                                          Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarGraficosFletores, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <ContainerUIElement3D.Children>
                            <p3d:Square3D x:Name="Grafico_FletorAB_XY"
                                          Material="{StaticResource Material_Grafico_FletorAB_XY}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_FletorAB_XY}"
                                          ToolTipService.ToolTip="Fletor - AB (plano XY) : 53 kN.m -> 5 kN.m" />

                            <p3d:Square3D x:Name="Grafico_FletorAB_XZ"
                                          Material="{StaticResource Material_Grafico_FletorAB_XZ}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_FletorAB_XZ}"
                                          ToolTipService.ToolTip="Fletor - AB (plano XZ) : 40 kN.m -> 20 kN.m" />

                            <p3d:Square3D x:Name="Grafico_FletorCD_YZ"
                                          Material="{StaticResource Material_Grafico_FletorCD_YZ}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_FletorCD_YZ}"
                                          ToolTipService.ToolTip="Fletor - CD (plano YZ) : 24 kN.m -> 0" />

                            <p3d:Square3D x:Name="Grafico_FletorBC_YZ"
                                          Material="{StaticResource Material_Grafico_FletorBC_YZ}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_FletorBC_YZ}"
                                          ToolTipService.ToolTip="Fletor - BC (plano YZ) : 24 kN.m" />

                            <p3d:Square3D x:Name="Grafico_FletorCD_XZ"
                                          Material="{StaticResource Material_Grafico_FletorCD_XZ}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_FletorCD_XZ}"
                                          ToolTipService.ToolTip="Fletor - CD (plano XZ) : 20 kN.m -> 0" />
                            
                            <p3d:Square3D x:Name="Grafico_FletorBE"
                                          Material="{StaticResource Material_Grafico_FletorBE}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_FletorBE}"
                                          ToolTipService.ToolTip="Fletor - BE : 15 kN.m -> 0" />
                            
                            <p3d:Square3D x:Name="Grafico_FletorBC_XY"
                                          Material="{StaticResource Material_Grafico_FletorBC_XY}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_FletorBC_XY}"
                                          ToolTipService.ToolTip="Fletor - BC (plano XY) : 5 kN.m -> 0" />

                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>
                    <!-- Torçores -->
                    <ContainerUIElement3D x:Name="Graficos_Torcores"
                                          Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarGraficosTorcores, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <ContainerUIElement3D.Children>
                            
                            <p3d:Square3D x:Name="Grafico_TorcorAB"
                                          Material="{StaticResource Material_Grafico_TorcorAB}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_TorcorAB}"
                                          ToolTipService.ToolTip="Torçor - AB : -39 kN.m" />
                            
                            <p3d:Square3D x:Name="Grafico_TorcorBC"
                                          Material="{StaticResource Material_Grafico_TorcorBC}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_TorcorBC}"
                                          ToolTipService.ToolTip="Torçor - BC : -20 kN.m" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>

                    <!-- Normais -->
                    <ContainerUIElement3D x:Name="Graficos_Normais"
                                          Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarGraficosNormais, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <ContainerUIElement3D.Children>
                            <p3d:Square3D x:Name="Grafico_NormalAB"
                                          Material="{StaticResource Material_Grafico_NormalAB}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_NormalAB}"
                                          ToolTipService.ToolTip="Normal - AB: 5 kN - Compressão" />

                            <p3d:Square3D x:Name="Grafico_NormalBC"
                                          Material="{StaticResource Material_Grafico_NormalBC}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_NormalBC}"
                                          ToolTipService.ToolTip="Normal - BC: 12 kN - Tração" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>

                </ContainerUIElement3D.Children>
            </ContainerUIElement3D>

        </Viewport3D>
    </tools:TrackballDecorator>
</ctrls:Exercicio>
